<template>
    <div>
        <el-row>
            <el-col>
                <el-form :inline="true" :model="formInline">
                    <el-form-item>
                        <el-input size="mini" v-model="formInline.testName" placeholder="请输入实训室名称"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-select clearable size="mini" v-model="formInline.isRectifyed" placeholder="请选择状态">
                            <el-option label="已整改" value="1"></el-option>
                            <el-option label="未整改" value="0"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" size="mini" @click="search">查询</el-button>
                    </el-form-item>
                </el-form>
            </el-col>
        </el-row>
        <!--<el-row class="buttonList">
            <el-col>
                <el-button type="primary" size="mini">查看</el-button>
            </el-col>
        </el-row>-->
        <el-row>
            <el-col>
                <el-table
                        :data="tableData"
                        border
                        @selection-change="handleSelectionChange"
                        size="mini"
                        style="width: 100%">
                    <el-table-column
                            align="center"
                            type="selection"
                            width="55">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="TESTNAME"
                            label="实训室名称">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="isRectify"
                            label="需要整改">
                        <template slot-scope="scope">
                            {{scope.row.isRectify ? '是' : '否'}}
                        </template>
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="isRectifyed"
                            label="状态">
                        <template slot-scope="scope">
                            {{scope.row.isRectifyed ? '是' : '否'}}
                        </template>
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="CREATEUSERNAME"
                            label="检查人">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            width="180px"
                            prop="CREATETIME"
                            label="创建时间">
                        <template slot-scope="scope">
                            {{new Date(scope.row.CREATETIME).toLocaleString()}}
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        background
                        layout="total, sizes, prev, pager, next, jumper"
                        :page-size="pagination.pageSize"
                        :total="pagination.total"
                        :page-sizes="[10, 20, 30, 50, 100]"
                >
                </el-pagination>
            </el-col>
        </el-row>
    </div>
</template>

<script>
    export default {
        name: "inspectDay",
        data() {
            return{
                pagination: {
                    pageSize: 20,
                    total: 1,
                    pageNo: 1
                },
                formInline: {},
                tableData: [],
                selectId: []
            }
        },
        created() {
            this.getTableData(this.pagination.pageSize, this.pagination.pageNo)
        },
        methods: {
            search() {
                this.$post('/checkDay/findCheckDay', {
                    pageSize:this.pagination.pageSize,
                    pageNo: 1,
                    testName: this.formInline.testName,
                    isRectifyed: this.formInline.isRectifyed
                }).then(res => {
                    if(res.data.status != 1) {
                        this.$message.error('条件输入错误，请检查');
                        return;
                    }
                    this.pagination.total = res.data.data.total;
                    this.tableData = res.data.data.dataList;
                })
            },
            getTableData(pageSize, pageNo) {
                this.$post('/checkDay/findCheckDay', {pageSize,pageNo}).then(res => {
                    this.tableData = res.data.data.dataList;
                    this.pagination.total = res.data.data.total;
                })
            },
            newAdd() {
                this.dialogFormVisible2 = true;
                this.isShow = false
            },
            handleSelectionChange(val) {
                this.selectId = val;
            },
            handleSizeChange(size) {
                this.pagination.pageSize = size;
                this.getTableData(size, this.pagination.pageNo);
            },
            handleCurrentChange(page) {
                this.pagination.pageNo = page;
                this.getTableData(this.pagination.pageSize, page);
            }
        }
    }
</script>

<style scoped lang="scss">
    .dateStyle{
        /deep/.el-input__inner {
            padding-left: 30px !important;
        }
    }
    /deep/.el-form-item__error {
        top: 32px;
    }
    .qrcode {
        text-align: center;
        /deep/img {
            margin: 0 auto;
        }
    }
    .station {
        /deep/img {
            margin: 20px;
        }
    }
</style>
